package fag.core.game.space;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

import fag.core.geometry.Rectangle2D;
import fag.core.geometry.Vector2D;
import fag.core.model.Animation;
import fag.core.model.Frame;
import fag.core.model.Model;
import fag.core.model.SerializableImage;
import fag.core.model.Sprite;

public class LaserModel extends Model {

	private static final long serialVersionUID = -1039864597492233003L;

	public LaserModel() {
		
		Animation a = new Animation();
		
		Frame f = new Frame(200);
		BufferedImage b = null;
		try {
			b = ImageIO.read(new File(System.getProperty("user.dir")+"/src/imgs/arkanoid/laser.png"));
		} catch (IOException e) {
			e.printStackTrace();
		}
		Sprite s = new Sprite(new SerializableImage(b), new Vector2D());
		Rectangle2D hitbox = new Rectangle2D(0, 0, s.getWidth(), s.getHeight());
		
		f.setHitbox(hitbox);
		f.setSprite(s);
		f.updateBounds();
		
		a.addFrame(f);
		
		getListAnimation().add(a);
	}

}